﻿/**
 * company js*
 */

var companyObject = {
    "areaTitleOn" : function (areaTitleName) {
                        $("." + areaTitleName).css("background","#fbb632")
                     },
    "areaTitleOff" : function (areaTitleName) {
                        $("." + areaTitleName).css("background","#fff")
                      },
    "areaTitleInfoOn" : function (areaTitleName) {
                        // $("." + areaTitleName).css("display","block")
                    $("." + areaTitleName).css("visibility","visible");
                    },
    "areaTitleInfoOff" : function (areaTitleName) {
                        // $("." + areaTitleName).css("display","none")
                    $("." + areaTitleName).css("visibility","hidden");
                    }
};


$(document).ready(function(){

    //区域幕布显示
    // showAreaOverlay();

    //区域标记信息
    showAreaTitle();

    showAreaImageInfo();

    //鼠标移入 移除座位效果
    desk();

});

// function showArea() {
//     var companyAreaA;
//     companyAreaA = ({
//         baseCSS: {
//             width: '300px',
//             height: '154px',
//             padding: '0px'
//         },
//         selectedCSS: {
//             top: '-300px',
//             left: '100px',
//             width: '85%',
//             height: '300px',
//             padding: '5px'
//         }
//     });
//
//
//     $(".company-area-a").on("mouseover",function () {
//         $(".company-area-a").css({"background-image":"url('img/company/007.jpg')",
//             "cursor":"pointer"
//         });
//     })
//     $(".company-area-a").on("mouseout",function () {
//         $(".company-area-a").css("background-image","url('img/company/008.jpg')");
//     })
//
//     //区域消失
//     function disappearArea() {
//         $(".company-area-a").fadeOut('fast');
//     }
//
//     //编辑区域显示
//     function disappearAreaShow() {
//         // $(".company-area-A-show").fadeIn('fast');
//         $(".area-center").fadeOut('fast');
//     }
//
//     //编辑区域显示
//     function disappearAreaShow1() {
//         // $(".company-area-A-show").fadeIn('fast');
//         $(".company-area-A-show").css('display', "block");
//     }
//
//
//     //放大-1
//     function hideSelected(callback){
//         // debugger;
//         $(callback).animate(companyAreaA.selectedCSS, 'slow', function () {
//             disappearAreaShow();
//             disappearAreaShow1();
//         })
//     }
//
//     function select(el){
//
//         hideSelected("." + el);
//     }
//
//     $(".company-area-a").on("click",function () {
//             select($(this).attr("class"));
//             $('.company-area-a').bind('click', function(){
//             hideSelected().delay(200).disappearAreaShow();;
//
//         });
//
//     });
//
// }


//区域标记信息
function showAreaTitle() {
    var areaTitleNameB = "second-floor-B-title";
    var areaTitleNameC = "second-floor-C-title";
    var areaTitleInfoC = "second-floor-C-title-info";
    var areaTitleNameD = "second-floor-D-title";
    var areaTitleInfoD = "second-floor-D-title-info";
    var areaTitleNameE = "second-floor-E-title";
    var areaTitleInfoE = "second-floor-E-title-info";

    //二楼B区 鼠标触发去区域标识和信息
    $(".second-floor-B").on("mouseover", function () {
        companyObject.areaTitleOn(areaTitleNameB);
    });
    $(".second-floor-B").on("mouseout", function () {
        companyObject.areaTitleOff(areaTitleNameB);
    });

    //二楼D区 鼠标触发区域标识和信息
    $(".second-floor-D").on("mouseover", function () {
        companyObject.areaTitleOn(areaTitleNameD);
        companyObject.areaTitleInfoOn(areaTitleInfoD);
    });
    $(".second-floor-D").on("mouseout", function () {
        companyObject.areaTitleOff(areaTitleNameD);
        companyObject.areaTitleInfoOff(areaTitleInfoD);
    });

    //二楼E区 鼠标触发区域标识和信息
    $(".second-floor-E").on("mouseover", function () {
        companyObject.areaTitleOn(areaTitleNameE);
        companyObject.areaTitleInfoOn(areaTitleInfoE);
    });
    $(".second-floor-E").on("mouseout", function () {
        companyObject.areaTitleOff(areaTitleNameE);
        companyObject.areaTitleInfoOff(areaTitleInfoE);
    });

    //二楼C区 鼠标触发区域标识和信息
    $(".second-floor-C").on("mouseover", function () {
        companyObject.areaTitleOn(areaTitleNameC);
        companyObject.areaTitleInfoOn(areaTitleInfoC);
    });
    $(".second-floor-C").on("mouseout", function () {
        companyObject.areaTitleOff(areaTitleNameC);
        companyObject.areaTitleInfoOff(areaTitleInfoC);
    });
}

//区域弹出消息信息
function showAreaImageInfo() {
    $(".second-floor-D").on("click", function () {
        alert("二楼D区");
    });

    $(".second-floor-E").on("click", function () {
        alert("二楼E区");
    });

    $(".floor-B-overlay").on("click", function () {
        $(".area-center-second-floor").addClass("area-center-second-floor-active");
        setTimeout(
            function(){
                $(".second-floor-B-detail").css("display","block");
                $(".second-floor-B-detail").addClass("second-floor-B-detail-active");
            },100
        );
        setTimeout(function(){$(".area-center-second-floor").css("visibility","hidden")},100);
    });
}

//鼠标移入 移出座位效果
function desk() {
    $(".info-icon3").mouseover(function () {
        var srcInfo = this.src;
        if (isPicture(srcInfo)){
            $(".info-icon3").attr('src', 'img/company/chair-haveCabinet-red-right.png');
        }
    });
    $(".info-icon3").mouseout(function () {
        var srcInfo = this.src;
        var isCon = isContainsString(srcInfo, "chair-haveCabinet-selected-right.png");
        if (isCon){
            $(".info-icon3").attr('src', 'img/company/chair-haveCabinet-selected-right.png');
        }
    });

    $(".info-icon4").mouseover(function () {
        $(".info-icon4").attr('src', 'img/company/chair-haveCabinet-red-right.png');
    });
    $(".info-icon4").mouseout(function () {
        $(".info-icon4").attr('src', 'img/company/chair-haveCabinet-selected-right.png');
    });

    $(".info-icon5").mouseover(function () {
        $(".info-icon5").attr('src', 'img/company/chair-red-right.png');
    });
    $(".info-icon5").mouseout(function () {
        $(".info-icon5").attr('src', '');
    });
    $(".info-icon6").mouseover(function () {
        $(".info-icon6").attr('src', '');
    });
}

function handleMouse(e) {
    // var cssData = {
    //     "addChairRedRight" : function() {
    //                             $(".info-icon3").attr('src', 'img/company/chair-haveCabinet-red-right.png');
    //                          }
    //      if （event.type）{
    //
    // }
    // }
}